//
//  DeviceCell.m
//  CoolMove
//
//  Created by CA on 15/4/14.
//  Copyright (c) 2015年 CA. All rights reserved.
//

#import "DeviceCell.h"
#import "LGPeripheral.h"

@interface DeviceCell ()
@property (weak, nonatomic) IBOutlet UIImageView *dotImageView;
@property (weak, nonatomic) IBOutlet UILabel *deviceNameLabel;
@property (weak, nonatomic) IBOutlet RssiView *rssiView;
@property (weak, nonatomic) IBOutlet UIImageView *bindingImageView;
@end

@implementation DeviceCell

- (void)awakeFromNib {
    // Initialization code
    self.rssiView.rssiColor = kSelectedColor;
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

}

#pragma mark - Public Method

+ (UINib *)nib
{
    return [UINib nibWithNibName:@"DeviceCell" bundle:nil];
}

- (void)configureWithPeirpheral:(LGPeripheral *)lgPeripheral
{
    self.rssiView.rssiValue = @(lgPeripheral.RSSI);
    self.deviceNameLabel.text = lgPeripheral.name;
    if (lgPeripheral.isSelected) {
        self.dotImageView.image = [UIImage imageNamed:@"sport_icon_search_select"];
    } else {
        self.dotImageView.image = [UIImage imageNamed:@"sport_icon_search_unselect"];
    }
}

- (void)setIsBinding:(BOOL)isBinding
{
    _isBinding = isBinding;
    if (isBinding) {
        self.bindingImageView.image = [UIImage imageNamed:@"search_icon_binding"];
    } else {
        self.bindingImageView.image = [UIImage imageNamed:@"search_icon_binding_question"];
    }
}

#pragma mark - Public Method

- (void)configureDeviceNameLabelTextColor:(UIColor *)color
{
    self.deviceNameLabel.textColor = color;
}

#pragma mark - Private Method

- (void)prepareForReuse
{
    [super prepareForReuse];
    
}

@end
